'use strict';

const Controller = require('egg').Controller;

class BookController extends Controller {
    // resources  index / create / destroy / update
    // 查询
    async index() {
        let res = await this.ctx.service.book.index()
        this.ctx.body = res
    }
    // 查询书籍类目
    async getclazz() {
        let res = await this.ctx.service.book.getclazz()
        this.ctx.body = res

    }
    // 条件查询
    async search() {
        let params = this.ctx.request.query;
        let res = await this.ctx.service.book.search(params)
        this.ctx.body = res
    }
    // 添加
    async create() {
        let res = await this.ctx.service.book.create()
        this.ctx.body = res
    }
    // 删除
    async destroy() {
        let res = await this.ctx.service.book.destroy()
        this.ctx.body = res

    }
    // 修改
    async update() {
        let res = await this.ctx.service.book.update()
        this.ctx.body = res
    }
}

module.exports = BookController;
